Step 1 - Prepare the nodes in your project
Before you can create reflections, you have to prepare the nodes in your project for which you want to create reflections.
In this step you first use an Empty Node 3D node and define its Scale property value to create a mirror image of all nodes it contains. Then you use Instantiator nodes that create a visual copy of the nodes for which you want to create reflections, including lights, and create a reflection plane.
Along the way you use tags to mark the nodes either as origin or a reflection. In the next step of the tutorial you use these tags to collect the nodes with two tag filters and pass each to a different render pass.
Assets for the tutorial
The starting point of this tutorial is the Reflections.kzproj Kanzi Studio project file stored in the <KanziWorkspace>/Tutorials/Reflections/Assets directory.
The <KanziWorkspace>/Tutorials/Reflections/Completed directory contains the completed project of this tutorial.
Prepare the nodes in your project
- In Kanzi Studio open the project stored in <KanziWorkspace>/Tutorials/Reflections/Assets.
This project contains a Trajectory List Box 3D node with several 3D models and lights. In this tutorial you create the reflection of these nodes.
- In the Project press Alt and right-click the Scene node that contains the nodes for which you want to create a reflection, select Empty Node 3D, and name it Reflection.
You use this node to create the mirror reflection.
- In the Properties add the Render Transformation property, disable the Uniform option, and set:
- Scale Y to -1
By setting the Scale Y attribute you create the mirror reflection of the nodes in the Empty Node 3D by flipping the node on the y axis. - Translation Y to -0,5
With the Translation Y attribute you control the distance between the origin and its reflection.
- In the Project select or create the nodes for which you want to create reflections (including all the lights), and in the Properties set the Tags property to Origin.
For example, in the Project select the Directional Light, Trajectory List Box 3D, and both Point Light nodes.
If you have more than one node and you want to create a reflection for all nodes, group them under the same node, and tag their parent node. For example, place the nodes into a Trajectory List Box 3D or an Empty Node.
- Create the Instantiator nodes from the nodes for which you want to create a reflection:
- In the Project press Alt and right-click the Trajectory List Box 3D node and select Instantiate Into an Instantiator.
You use the Instantiator nodes to create a visual copy of the nodes for which you want to create reflections.
- In the Properties set the Tags property to Reflection.
- Move the Instantiator node to the Reflection node.
- Repeat the previous step for the Directional Light and both Point Light nodes.
- In the Project create a reflection plane in the same scene where you created the origin and reflection nodes.
For example, press Alt and right-click the Scene node, select Plane, and name it Reflection plane.
- In the Project select the Reflection plane node and in the Properties add and set:
- Tags to Origin
- Blend Intensity to 0,7
With Blend Intensity you adjust the reflection level: the lower the value the stronger the reflection. - Blend Mode to Alpha: Premultiplied
- Ambient Color to a color you want to use for the Reflection plane.
TIPIn Kanzi Studio you can apply color in hexadecimal format to all properties that set a color. In a tool that you use to set the color, copy the hexadecimal code of a color, in Kanzi Studio in the Properties right-click the color swatch of the property for which you want to use that color, and select Paste Color in Hex Format.
- In the Preview use the Node tool to rotate, scale, and position the Reflection plane between the origin and reflection nodes.
< INTRODUCTION
NEXT STEP >
See also
To find out more about how to use tags, see Using tags.
Open topic with navigation